/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Alexander Velichkov
 */
public class Complex {
    private double x;
    private double y;

    public Complex(double x, double y) {
        this.x = x;
        this.y = y;
    }

    public Complex() {
        x = 0;
        y = 0;
    }

    public Complex(Complex complex) {
        this(complex.getX(), complex.getY());
    }

    public double getX() {
        return x;
    }

    public double getY() {
        return y;
    }
    
    public Complex plus(Complex c){
        return new Complex(x + c.getX(), y + c.getY());
    }
    
    public Complex minus(Complex c){
        return new Complex(x - c.getX(), y - c.getY());
    }
    
    public Complex times(Complex c){
        return new Complex(x*c.getX() - y*c.getY(), x*c.getY() + y*c.getX());
    }
    
    public double dist(){
        return Math.sqrt(x*x + y*y);
    }

    public double distSq()
    {
        return x*x + y*y;
    }
}
